<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="UserCreateDlg" widgetVar="UserCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateUserTitle}">

            <h:form id="UserCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{userController.selected != null}">

                        <p:outputLabel value="#{bundle.CreateUserLabel_userName}" for="userName" />
                        <p:inputText id="userName" value="#{userController.selected.userName}" title="#{bundle.CreateUserTitle_userName}" />

                        <p:outputLabel value="#{bundle.CreateUserLabel_passWord}" for="passWord" />
                        <p:inputText id="passWord" value="#{userController.selected.passWord}" title="#{bundle.CreateUserTitle_passWord}" />

                        <p:outputLabel value="#{bundle.CreateUserLabel_email}" for="email" />
                        <p:inputText id="email" value="#{userController.selected.email}" title="#{bundle.CreateUserTitle_email}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_email}"/>

                        <p:outputLabel value="#{bundle.CreateUserLabel_picture}" for="picture" />
                        <p:inputText id="picture" value="#{userController.selected.picture}" title="#{bundle.CreateUserTitle_picture}" />

                        <p:outputLabel value="#{bundle.CreateUserLabel_registerDate}" for="registerDate" />
                        <p:calendar id="registerDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{userController.selected.registerDate}" title="#{bundle.EditUserTitle_registerDate}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateUserLabel_lastLoginDate}" for="lastLoginDate" />
                        <p:calendar id="lastLoginDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{userController.selected.lastLoginDate}" title="#{bundle.EditUserTitle_lastLoginDate}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateUserLabel_rolidRol}" for="rolidRol" />
                        <p:selectOneMenu id="rolidRol" value="#{userController.selected.rolidRol}" required="true" requiredMessage="#{bundle.EditUserRequiredMessage_rolidRol}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{rolController.items}"
                                           var="rolidRolItem"
                                           itemValue="#{rolidRolItem}"
                                           itemLabel="#{rolidRolItem.descripcion.toString()}"
                                           />
                            <f:converter binding="#{rolConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{userController.saveNew}" value="#{bundle.Save}" update="display,:UserListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,UserCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="UserCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
